package com.example.musicplayer;

import android.content.Intent;
import android.os.Bundle;
import android.support.v7.app.ActionBarActivity;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
import android.widget.SeekBar;
import android.widget.TextView;

public class PlayActivity extends ActionBarActivity {
	Button pause;
	Button next;
	Button last;
	Intent intent;
	TextView songName;
	SeekBar seekBar;

	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.activity_play);

		Intent intent = new Intent(".MusicService");
		startService(intent);
		pause = (Button) findViewById(R.id.pause);
		next = (Button) findViewById(R.id.next);
		last = (Button) findViewById(R.id.last);
		songName = (TextView) findViewById(R.id.songName);
		seekBar = (SeekBar) findViewById(R.id.seekBar);
//		seekBar.setMax(1000);
		
		Intent intent1 = getIntent();
		String name = intent1.getStringExtra("songName");
		songName.setText(name);
		
		pause.setOnClickListener(new OnClickListener() {

			@Override
			public void onClick(View arg0) {
				Intent intent = new Intent();
				intent.setAction("com.musicplayer");
				intent.putExtra("msg", "PAUSE");
				sendBroadcast(intent);
			}
		});
		next.setOnClickListener(new OnClickListener() {

			@Override
			public void onClick(View arg0) {
				Intent intent = new Intent();
				intent.setAction("com.musicplayer");
				intent.putExtra("msg", "NEXT");
				sendBroadcast(intent);
			}
		});
		last.setOnClickListener(new OnClickListener() {

			@Override
			public void onClick(View arg0) {
				Intent intent = new Intent();
				intent.setAction("com.musicplayer");
				intent.putExtra("msg", "LAST");
				sendBroadcast(intent);
			}
		});
	}
}
